<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>

<% List<Supplier> suppliers= new ArrayList<Supplier>(); %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<%@ include file="validProgrammer.jsp" %>
<link href="<%=request.getContextPath()%>/styles/table.css" rel="stylesheet" type="text/css" />
</head>
<body>
<h1 align="center">商家管理</h1>    
  
        <form action="<%=request.getContextPath()%>/programmer4Jsp">
    <input type="hidden" name="affair" value="searchSupplier" />
    商家电话： <input type="text" name="telnum" style="display: inline;" />  
     所属业主： <input type="text" name="owner" style="display: inline;" />
     
    <input type="submit" value="搜索"> <br/>
    </form> 
   
<table width="100%" class="tableA">
 <tr>  
 <th width="8%"  style="BACKGROUND-COLOR: #FF0000" >商家电话</th> 
   <th width="8%" style="BACKGROUND-COLOR: #FF0000"> 所属业主</th>  
    <th width="8%" style="BACKGROUND-COLOR: #FF0000"  >是否启用</th> 
   <th width="8%" style="BACKGROUND-COLOR: #FF0000"> 商家名称</th>
    <th width="8%" style="BACKGROUND-COLOR: #FF0000"> 商家地址</th>
      <th width="8%" style="BACKGROUND-COLOR: #FF0000"> 服务电话</th>
     <th width="8%" style="BACKGROUND-COLOR: #FF0000"  >提前下单分钟</th> 
      <th width="8%" style="BACKGROUND-COLOR: #FF0000"  >最小起订金额</th> 
       <th width="8%" style="BACKGROUND-COLOR: #FF0000"  >业主提成比例</th> 
        <th width="8%" style="BACKGROUND-COLOR: #FF0000"  >缴纳箱格使用费</th> 
         <th width="8%" style="BACKGROUND-COLOR: #FF0000"  >收取箱格使用费</th>      
        <th width="12%" style="BACKGROUND-COLOR: #FF0000"  >操作</th> 
     </tr> 
<%!   String  caculateUse(String tag ){  
             String result="";           
            if(tag.equals("1")) result="启用";
             if(tag.equals("2")) result="未启用";
              if(tag.equals("0")) result="未定义";
            return result;
             }     %>
<%!   String  caculateTemp(String tag ){          
            String result="";           
            if(tag.equals("1")) result="常温";
             if(tag.equals("2")) result="加热";
              if(tag.equals("3")) result="制冷";
              if(tag.equals("0")) result="未定义";
            return result;
             }     %>
<%!String isAuth="未处理";  %>
 <% boolean success; 
    Object temp =request.getAttribute("success");
     if(temp==null){
     success=false;
     }else{
       success= (Boolean) temp;
     }
    if(success) {
               request.removeAttribute("success");
     suppliers= ( List<Supplier>) request.getSession().getAttribute("suppliers"); }
    
   
        for (int i = 0; i < suppliers.size(); i++) {     
             pageContext.setAttribute("supplier", suppliers.get(i));  
               if(suppliers.get(i).getIsAuth()==1) isAuth="已启用";
                if(suppliers.get(i).getIsAuth()==2) isAuth="未启用";
                 
         
                pageContext.setAttribute("row", i % 2 != 0 ? "odd" : "even"); %>           
                       <tr>           
                                    <td>${supplier.telnum}</td>               
                                    <td>${supplier.owner}</td>    
                                    <td><%=isAuth %></td>        
                                    <td>${supplier.name}</td>  
                                      <td>${supplier.address}</td>             
                                    <td>${supplier.serviceTelnum}</td>  
                                     <td>${supplier.minuteMini}</td>     
                                     <td>${supplier.moneyMini}</td>    
                                     <td>${supplier.rate}</td> 
                                     <td>${supplier.boxFeeSu}</td> 
                                     <td>${supplier.boxFeeCu}</td> 
                       <td><a href="<%=request.getContextPath()%>/programmer4Jsp?affair=modifySupplier&telnum=${supplier.telnum}">修改</a> |
                  
                        <a href="<%=request.getContextPath()%>/programmer4Jsp?affair=deleteSupplier&telnum=${supplier.telnum}">删除</a></td>           
                             </tr> 
<%} %>
  
 </table>  
 <br/>   <br/>   <br/>  
</body>
</html>
<script> 
//取出传回来的参数error并与yes比较
  var errorInfoA ='<%=request.getParameter("errorInfo")%>';
  var  errorInfo=decodeURI(errorInfoA);
  if(errorInfo!='null'){
   alert(errorInfo);}

</script>